package com.sql;

import com.domain.Car;
import org.orm.hsc.annotations.Insert;
import org.orm.hsc.annotations.Select;

import java.util.List;

/**
 * @author
 * @date 2025-04-19
 * @Description 通过注解方式简化代码
 */
public interface CarSql {
    /**
     * 插入的方法
     * @param car
     */
    @Insert(value = "insert into t_car values(null,#{cname},#{color},#{price})", propertyName = "cno")
    void save(Car car);

    @Select(value = "select * from t_car")
    List<Car> findAll();

    @Select(value = "select * from t_car where cno = #{cno}")
    Car findById(int id);

}
